Skip to main content

Sealos 部署 Kubernetes 集群

Last updated on

本文档用于在虚机环境中使用 Sealos 快速部署 Kubernetes 集群单节点环境。

准备工作

  • 单台 8C16G 纯净虚机。
  • 建议使用干净的操作系统来创建集群。不要自己装 Docker!
  • 支持大多数 Linux 发行版,例如:Ubuntu、CentOS、Rocky linux。
  • 支持使用 Containerd 作为容器运行时。
  • 一定需要 root 用户部署

联网环境部署 Sealos Kubernetes

mkdir /opt/sealos
cd /opt/sealos
curl http://storage.kindlingx.com/package/sealos-k8s/sealos-k8s-deploy-v1.1.0-online.sh | bash

离线环境部署 Sealos Kubernetes

下载离线安装包

mkdir ./sealos
cd ./sealos
curl http://storage.kindlingx.com/package/sealos-k8s/sealos-k8s-package-download-v1.1.0.sh | bash

执行下方命令检查安装包

ls -l # ~/sealos
total 951232
-rw-r--r--. 1 root root 351843328 Aug 16 16:02 calico-v3.24.1.tar
-rw-r--r--. 1 root root 17112576 Aug 16 16:00 helm-v3.14.0.tar
-rw-r--r--. 1 root root 411297280 Aug 16 16:01 kubernetes-v1.25-latest.tar
-rw-r--r--. 1 root root 130833408 Aug 16 16:02 openebs-v3.10.0.tar
-rw-r--r--. 1 root root 1175 Aug 16 16:02 sealos-k8s-deploy-v1.1.0.sh
-rw-r--r--. 1 root root 62963267 Aug 16 16:00 sealos_4.3.7_linux_amd64.tar.gz

sealos文件夹下所有文件移动到目标部署机器的/opt/sealos文件夹下,并在/opt/sealos文件夹下执行命令:

bash sealos-k8s-deploy-v1.1.0.sh

验证

脚本执行完成后预期有类似输出

2024-08-16T16:19:57 info succeeded in creating a new cluster, enjoy it!
2024-08-16T16:19:57 info
___ ___ ___ ___ ___ ___
/\ \ /\ \ /\ \ /\__\ /\ \ /\ \
/::\ \ /::\ \ /::\ \ /:/ / /::\ \ /::\ \
/:/\ \ \ /:/\:\ \ /:/\:\ \ /:/ / /:/\:\ \ /:/\ \ \
_\:\~\ \ \ /::\~\:\ \ /::\~\:\ \ /:/ / /:/ \:\ \ _\:\~\ \ \
/\ \:\ \ \__\ /:/\:\ \:\__\ /:/\:\ \:\__\ /:/__/ /:/__/ \:\__\ /\ \:\ \ \__\
\:\ \:\ \/__/ \:\~\:\ \/__/ \/__\:\/:/ / \:\ \ \:\ \ /:/ / \:\ \:\ \/__/
\:\ \:\__\ \:\ \:\__\ \::/ / \:\ \ \:\ /:/ / \:\ \:\__\
\:\/:/ / \:\ \/__/ /:/ / \:\ \ \:\/:/ / \:\/:/ /
\::/ / \:\__\ /:/ / \:\__\ \::/ / \::/ /
\/__/ \/__/ \/__/ \/__/ \/__/ \/__/

Website: https://www.sealos.io/
Address: github.com/labring/sealos
Version: 4.3.7-f39b2339

# 删除控制节点污点,报错不影响最终结果
error: taint "node-role.kubernetes.io/master" not found
error: taint "node-role.kubernetes.io/control-plane" not found

执行下方命令等待并确认所有 POD 处于Running状态

[root@demo sealos]# kubectl get po -A
NAMESPACE NAME READY STATUS RESTARTS AGE
calico-apiserver calico-apiserver-858b677f96-qlh9v 1/1 Running 0 4m24s
calico-apiserver calico-apiserver-858b677f96-rm6js 1/1 Running 0 4m24s
calico-system calico-kube-controllers-85666c5b94-rkp4v 1/1 Running 0 5m22s
calico-system calico-node-xnzz2 1/1 Running 0 5m22s
calico-system calico-typha-67b6658b4f-49rmq 1/1 Running 0 5m22s
calico-system csi-node-driver-gbhdz 2/2 Running 0 4m52s
kube-system coredns-565d847f94-6ghzd 1/1 Running 0 5m31s
kube-system coredns-565d847f94-cqpxm 1/1 Running 0 5m31s
kube-system etcd-node-69 1/1 Running 2 5m43s
kube-system kube-apiserver-node-69 1/1 Running 2 5m43s
kube-system kube-controller-manager-node-69 1/1 Running 2 5m43s
kube-system kube-proxy-56wwf 1/1 Running 0 5m31s
kube-system kube-scheduler-node-69 1/1 Running 2 5m46s
openebs openebs-localpv-provisioner-66454cfbb9-99bhd 1/1 Running 0 5m31s
tigera-operator tigera-operator-6675dc47f4-6b4fm 1/1 Running 0 5m31s

卸载 Sealos Kubernetes

sealos reset